/*! \file SmartPtrs.h
 *	\brief <write description for SmartPtrs.h>
 *
 *	created:	2009/11/10
 *	created:	10:11:2009   17:18
 *	filename: 	c:\src\main\libs\core\SmartPtrs.h
 *	file path:	c:\src\main\libs\core
 *	file base:	SmartPtrs
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#ifndef _CORE_SMARTPTRS_H_
#define _CORE_SMARTPTRS_H_

#pragma once

#include <memory>

#include <core/noncopyable.h>
#include <mem/mem.h>

namespace tt{

//////////////////////////////////////////////////////////////////////////
template<typename Type>
class ScopedPtr : NonCopyable
{
public:
	typedef Type* pointer_type;
	typedef Type& reference_type;
	typedef Type value_type;

public:
	explicit ScopedPtr(pointer_type pointer = NULL);
	~ScopedPtr();

	void reset(pointer_type pointer = NULL);
	void swap(ScopedPtr&);

	pointer_type operator->() const;
	reference_type operator*() const;
	operator pointer_type() const;

	pointer_type get() const;

private:
	pointer_type m_pointer;
};

//////////////////////////////////////////////////////////////////////////
#define SharedPtr std::shared_ptr
#define WeakPtr std::weak_ptr

using std::const_pointer_cast;
using std::dynamic_pointer_cast;
using std::static_pointer_cast;

} //namespace tt
#include "SmartPtr.inl"

#endif //_CORE_SMARTPTRS_H_